#include <bits/stdc++.h>
using namespace std;

int n, m;
string s1, s2;
int main()
{
    cin >> s1 >> s2;
    n = s1.size();
    m = s2.size();
    int count = m - n;
    int sum=0;
    for (int i = 0; i <= count; i++)
    {
        int tem=0;
        for(int j=0;j<n;j++)
        {
            if(s1[j]==s2[i+j])
            {
                tem++;
            }
        }
        sum=max(sum,tem);
    }
    cout<<m-sum-count<<endl;
}